import Vue from "vue";
import VueRouter from "vue-router";
import { storeRoutes } from "./StoreRoute";
import { flowRoutes } from "./FlowRoute";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    meta: {
      title: "注册",
    },
    name: "user",
    component: () => import("../views/user/index.vue"),
  },
  {
    path: "/register",
    name: "register",
    meta: {
      title: "注册账号",
    },
    component: () => import("../views/register/index.vue"),
  },
  {
    path: "/submitInfo/register",
    name: "subRegister",
    meta: {
      title: "注册账号",
    },
    component: () => import("../views/register/index.vue"),
  },
  {
    path: "/autograph",
    name: "autograph",
    meta: {
      title: "客户签名",
    },
    component: () => import("../views/register/autograph.vue"),
  },
  {
    path: "/mreinfo/index",
    name: "mreinfo",
    meta: {
      title: "我的",
    },
    component: () => import("../views/mreinfo/index.vue"),
  },
  {
    path: "/mreinfo/basicinfo",
    name: "basicinfo",
    meta: {
      title: "基本信息",
    },
    component: () => import("../views/mreinfo/basicinfo.vue"),
  },
  {
    path: "/mreinfo/corporateinfo",
    name: "corporateinfo",
    meta: {
      title: "法人信息",
    },
    component: () => import("../views/mreinfo/corporateinfo.vue"),
  },
  {
    path: "/mreinfo/annexinfo",
    name: "annexinfo",
    meta: {
      title: "附件信息",
    },
    component: () => import("../views/mreinfo/annexinfo.vue"),
  },
  {
    path: "/mreinfo/signupinfo",
    name: "signupinfo",
    meta: {
      title: "签约信息",
    },
    component: () => import("../views/mreinfo/signupinfo.vue"),
  },
  {
    path: "/mreinfo/settleinfo",
    name: "settleinfo",
    meta: {
      title: "结算信息",
    },
    component: () => import("../views/mreinfo/settleinfo.vue"),
  },
  {
    path: "/mreinfo/withdrawal",
    name: "withdrawal",
    meta: {
      title: "手动提现",
    },
    component: () => import("../views/mreinfo/withdrawal.vue"),
  },
  {
    path: "/mreinfo/settleedit",
    name: "settleedit",
    meta: {
      title: "结算信息",
    },
    component: () => import("../views/mreinfo/settleedit.vue"),
  },
  {
    path: "/mreinfo/settlesuccess",
    name: "settlesuccess",
    meta: {
      title: "结算信息",
    },
    component: () => import("../views/mreinfo/settlesuccess.vue"),
  },
  {
    path: "/mreinfo/modifyrecord",
    name: "modifyrecord",
    meta: {
      title: "修改记录",
    },
    component: () => import("../views/mreinfo/modifyrecord.vue"),
  },
  {
    path: "/mreinfo/changedetails",
    name: "changedetails",
    meta: {
      title: "变更详情",
    },
    component: () => import("../views/mreinfo/changedetails.vue"),
  },
  {
    path: "/productdetails",
    name: "changedetails",
    meta: {
      title: "产品详情",
    },
    component: () => import("../views/productdetails/index.vue"),
  },
  {
    path: "/productdetails/payorder",
    name: "changedetails",
    meta: {
      title: "支付状态",
    },
    component: () => import("../views/productdetails/payorder.vue"),
  },
  {
    path: "/protocol",
    name: "protocol",
    meta: {
      title: "协议",
    },
    component: () => import("../views/protocol/index.vue"),
  },
  {
    path: "/capage",
    name: "capage",
    meta: {
      title: "合作协议",
    },
    component: () => import("../views/capage/index.vue"),
  },
  {
    path: "/agreement",
    name: "agreement",
    meta: {
      title: "协议",
    },
    component: () => import("../views/agreement/index.vue"),
  },
  {
    path: "/purchaseAgreement",
    name: "purchaseAgreement",
    meta: {
      title: "购机协议",
    },
    component: () => import("../views/purchaseAgreement/index.vue"),
  },
  {
    path: "/privacy",
    name: "privacy",
    meta: {
      title: "隐私政策协议",
    },
    component: () => import("../views/privacy/index.vue"),
  },
  {
    path: "/privacyAgreement",
    name: "privacyAgreement",
    meta: {
      title: "隐私协议",
    },
    component: () => import("../views/privacyAgreement/index.vue"),
  },
  {
    path: "/userAgreement",
    name: "userAgreement",
    meta: {
      title: "用户协议",
    },
    component: () => import("../views/userAgreement/index.vue"),
  },
  {
    path: "/rnaguide",
    name: "rnaguide",
    meta: {
      title: "认证指南",
    },
    component: () => import("../views/rnaguide/index.vue"),
  },
  {
    path: "/activityApply",
    name: "activityApply",
    meta: {
      title: "活动报名",
      keepAlive: true
    },
    component: () => import("../views/activityApply/index.vue"),
  },
  {
    name: 'myApplyDetail',
    path:'/activityApply/myApplyDetail',
    component: () => import("../views/activityApply/views/myApplyDetail.vue")
  },
  {
    name: 'allActivityDetail',
    path:'/activityApply/allActivityDetail',
    component: () => import("../views/activityApply/views/allActivityDetail.vue")
  },
  {
    name: 'subsidyAbout',
    path:'/activityApply/subsidyAbout',
    component: () => import("../views/activityApply/views/subsidyAbout.vue")
  },
  {
    path: "/helpcenter/index",
    name: "helpcenter",
    meta: {
      title: "帮助中心",
    },
    component: () => import("../views/helpcenter/index.vue"),
  },
  {
    path: "/banner",
    name: "banner",
    meta: {
      title: "banner广告",
    },
    component: () => import("../views/banner/index.vue"),
  },
  {
    path: "/setupnotes",
    name: "setupnotes",
    meta: {
      title: "设置说明",
    },
    component: () => import("../views/setupnotes/index.vue"),
  },
  {
    path: "/setupnotes/setpage",
    name: "setpage",
    meta: {
      title: "设置说明",
    },
    component: () => import("../views/setupnotes/setpage.vue"),
  },
  ...flowRoutes,
  ...storeRoutes,
];
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject) {
    return originalPush.call(this, location, onResolve, onReject);
  }
  return originalPush.call(this, location).catch((err) => err);
};
const router = new VueRouter({
  routes,
});

export default router;
